home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Peter Lewis / PNL Libraries / MyHandleQuitBoth.p < prev    next >
Encoding:
Text File  |  1994-09-23  |  1.2 KB  |  60 lines  |  [TEXT/PJMM]

  1. unit MyHandleQuitBoth;
  2.  
  3. interface
  4.  
  5.     procedure InitQuitBoth (creator: OSType; both_index, justus_index: integer);
  6.     procedure FinishQuitBoth;
  7.  
  8. implementation
  9.  
  10.     uses
  11.         MyTypes, BaseGlobals, MyProcesses, MyFMenus;
  12.  
  13.     var
  14.         quitBoth: boolean;
  15.         creatorType: OSType;
  16.         both, justus: integer;
  17.  
  18.     procedure DoQuit;
  19.     begin
  20.         quitNow := true;
  21.         if quitBoth then begin
  22.             QuitApplication(creatorType, application);
  23.         end;
  24.     end;
  25.  
  26.     procedure SetQuit (themenu, theitem: integer);
  27.         var
  28.             dummyb: boolean;
  29.             er: eventRecord;
  30.             nqb: boolean;
  31.             process: processSerialNumber;
  32.             s: str255;
  33.             fs: FSSpec;
  34.     begin
  35.         dummyb := GetOSEvent(0, er);
  36.         nqb := (BAND(er.modifiers, optionKey) <> 0) & FindProcess(creatorType, application, process, fs);
  37.         if nqb <> quitBoth then begin
  38.             quitBoth := nqb;
  39.             if quitBoth then
  40.                 GetIndString(s, global_strh_id, both)
  41.             else
  42.                 GetIndString(s, global_strh_id, justus);
  43.             SetItem(GetMHandle(themenu), theitem, s);
  44.         end;
  45.     end;
  46.  
  47.     procedure InitQuitBoth (creator: OSType; both_index, justus_index: integer);
  48.     begin
  49.         quitBoth := false;
  50.         creatorType := creator;
  51.         both := both_index;
  52.         justus := justus_index;
  53.         SetFBoth(CQuit, @DoQuit, @SetQuit);
  54.     end;
  55.  
  56.     procedure FinishQuitBoth;
  57.     begin
  58.     end;
  59.  
  60. end.